import * as CryptoJS from 'crypto-js';

/**
 * 密码加密
 * @param {Object} word
 * @author 瑾年
 * @return str
 */
export function encrypt(word) {
    var key = CryptoJS.enc.Utf8.parse("AESmoss077o3WERT");
    var srcs = CryptoJS.enc.Utf8.parse(word);
    var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
    return encrypted.toString();
}
/**
 * 解密
 * @param word
 * @author 瑾年
 * @return str
 */
export function decrypt(word) {
    var key = CryptoJS.enc.Utf8.parse("AESmoss077o3WERT");
    var decrypt = CryptoJS.AES.decrypt(word, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
    return CryptoJS.enc.Utf8.stringify(decrypt).toString();
}

